<?php
/**
 * Responsibilities
 * Handle navigation input/output
 * Create links to different parts of the applikation (controllers)
 * Handle navigation-input
 * Create main menu
 */
class NavigationView {
	const USER_VIEWS_BECOME_MEMBER = "registermember";
	const LOGIN_PAGE = "login";
	const CONTROLLER = "controller";
	const LOGOUT_PAGE = "logout";
	const MAKE_NEW_POST_CONTROLLER = "newpost";
	const DELETE_MEMBER__CONTROLLER = "deletemember";
	const UPDATE_POST = "updatepost";
	const FILE_UPLOAD_CONTROLLER = "uploadimage";
	
	//Returns which controller is active. 
	public function GetActiveControllerType() {
		if(isset($_GET[self::CONTROLLER])){
			$i = $_GET[self::CONTROLLER];
			switch ($i) {
			    case self::USER_VIEWS_BECOME_MEMBER:
			        return self::USER_VIEWS_BECOME_MEMBER;
			        break;
			    case self::LOGIN_PAGE:
			        return self::LOGIN_PAGE;
			        break;
			    case self::MAKE_NEW_POST_CONTROLLER:
			        return self::MAKE_NEW_POST_CONTROLLER;
			        break;
				case self::UPDATE_POST:
			        return self::UPDATE_POST;
			        break;
				case self::DELETE_MEMBER__CONTROLLER:
			        return self::DELETE_MEMBER__CONTROLLER;
			        break;
				case self::LOGOUT_PAGE:
			        return self::LOGOUT_PAGE;
			        break;
				case self::FILE_UPLOAD_CONTROLLER:
			        return self::FILE_UPLOAD_CONTROLLER;
			        break;
				default: 
					return false;
					break;
			}	
		}else{
			return false;
		}
	}
	
	public function NavigateToPost ($id, $categoryIdUrlParameter){
		header("Location: index.php?".$categoryIdUrlParameter."=".$id."");
	}

}
